
<!DOCTYPE html >
<html>
<head>
    <meta name="Generator" content="ECSHOP v2.7.3" />
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width">
    <title>提交订单  </title>  <link rel="icon" href="/template/pc1/images/wmh_favicon.ico" type="image/x-icon" />
    <meta name="Keywords" content="" />
    <meta name="Description" content="" />
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
    <link rel="stylesheet" href="/template/default/css/public.css">
    <link rel="stylesheet" href="/template/default/css/flow.css">
    <style>
        .content_success li{
            height: auto;
        }
    </style>
<body style="background: rgb(235, 236, 237);">
<div class="tab_nav">
    <div class="header">
        <div class="h-left">
            <a class="sb-back" href="javascript:history.back(-1)" title="返回"><img
                    src="/template/default/images/arrow_left_white.png"/></a>
        </div>
        <div class="h-mid">提交订单</div>
    </div>
</div>

<div class="screen-wrap fullscreen login">
    
    <div class="content_success " >
        <div class="con-ct   fo-con">
            <h4 class="successtijiao">订单已经提交成功！</h4>
            <ul class="ct-list">
                <li>
                    订单号为：<em>${ordersPlateform.orderSn!}</em>
                </li>
                <!--<li>
                    您选定的配送方式为:<em>${ordersPlateform.deliveryTypeName}</em>
                </li>-->
                <li>
                    您选定的支付方式为:<em>${ordersPlateform.paymentConfigName}</em>
                </li>
                <li>
                    您的订单总金额为:<em class="price">￥${ordersPlateform.totalAmount}元</em>(含运费￥${ordersPlateform.deliveryFee} <%if(ordersPlateform.paymentFee!=0.00){%>手续费￥${ordersPlateform.paymentFee}<%}%>)
                </li>
                <li>
                    您的订单应付款金额为:<em class="price">￥${ordersPlateform.unpaidAmount}元</em><%if(ordersPlateform.paidDeposit > 0){%>(余额支付 ${ordersPlateform.paidDeposit})<%}%><%if(ordersPlateform.paidPointAsDeposit > 0){%>(积分抵扣 ${ordersPlateform.paidPointAsDeposit})<%}%>
                </li>
            </ul>

        </div>
        <%if (ordersPlateform.paymentConfig != null){%>
            <form action="/b/payment/gateway" method="post" style="margin-bottom: 40px">
                <input type="hidden" name="amountPayable" value="${amountPayable!}" />
                <input type="hidden" name="paymentConfig.id" value="${ordersPlateform.paymentConfig.id!}" />
                <input type="hidden" name="openId" value="${openId!}"/>
                <input type="hidden" name="paymentType" value="${ordersPlateform.paymentConfig.paymentConfigTypeValue}" />
                <input type="hidden" name="shopId" value="${shopId!}" />
                <input type="hidden" name="orderPlateFormId" value="${ordersPlateform.id!}">
                <div class="blank"></div>
                <br/>
                <table class="listTable">
                    <tr>
                        <!--如果是微信支付,用post提交-->
                        <%if(ordersPlateform.paymentConfig.paymentConfigTypeValue=="weixin"){%>
                            <button type="button" id=''  name="submit" value="yes" onclick="wxpay();" style="width:100%;display: inline-block;padding: 0 33px;text-align: center;height: 35px;line-height: 35px;margin-right: 10px;color: #fff;background: #ff521d;font-size: 16px;border: none;border-radius: 5px;margin-top: 20px;">立即支付</button><p></p>
                        <%}else{%>
                            <button type="submit" id='submit'  name="submit" value="yes" style="width:100%;display: inline-block;padding: 0 33px;text-align: center;height: 35px;line-height: 35px;margin-right: 10px;color: #fff;background: #ff521d;font-size: 16px;border: none;border-radius: 5px; margin-top: 20px;" >立即支付</button><p></p>
                        <%}%>
                    </tr>
                </table>
            </form>
        <%}%>
        <div class=""style="margin-top: 40px;font-size: 13px;color:#a3afb7;padding: 0 20px">
            温馨提示：请收货后点击确认，确认之日起五个工作日内可以申请退换货，超过时间视为无异议。未点击确认的从发货之日起10日视为收货。
        </div>
    </div>

</div>

</body>
<script type="text/javascript" src="https://static.9hive.cn/global/vendor/jquery/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="/template/default/js/ecsmart.js"></script>

<!--微信支付-->
<script type="text/javascript" src="/res/plugins/weixin/static/weui/lib/jquery-2.1.4.js"></script>
<script type='text/javascript' src="/res/plugins/weixin/static/weui/js/jquery-weui.js"></script>
<!-- layer -->
<script src="/res/plugins/weixin/static/layer/layer.js"></script>
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
<script type="text/javascript">
    /* 微信支付 */
    function wxpay(){
        //测试时修改为自己的openId 如果不修改会出现【下单账号与支付账号不一致】的提示 这里最好授权获取
        var openId=$("input[name='openId']").val();
        var total_fee="${ordersPlateform.unpaidAmount}";//总费用
        var orderPlateFormId=$("input[name='orderPlateFormId']").val();
        var paymentConfigId=$("input[name='paymentConfig.id']").val();
        var paymentType=$("input[name='paymentType']").val();

        $.post("/b/payment/gateway",
                {
                    "orderPlateFormId":orderPlateFormId,
                    "paymentType":paymentType
                },
                function(res){
                    if (res.code == 0) {

                        var data=$.parseJSON(res.data);
                        if (typeof WeixinJSBridge == "undefined"){
                            if( document.addEventListener ){
                                document.addEventListener('WeixinJSBridgeReady', onBridgeReady(data), false);
                            }else if (document.attachEvent){
                                document.attachEvent('WeixinJSBridgeReady', onBridgeReady(data));
                                document.attachEvent('onWeixinJSBridgeReady', onBridgeReady(data));
                            }
                        }else{
                            onBridgeReady(data);
                        }
                    }else{
                        if (res.code == 2) {
                            layer.alert(res.message) ;
                        }else{
                            layer.msg("参数错误："+res.message, {shift: 6});
                        }
                    }
                });
    }
    function onBridgeReady(json){
        WeixinJSBridge.invoke(
                'getBrandWCPayRequest',
                json,
                function(res){
                    /*for( var key in res){
                        alert(key+":"+res[key]);
                    }*/
                    // 使用以上方式判断前端返回,微信团队郑重提示：res.err_msg将在用户支付成功后返回    ok，但并不保证它绝对可靠。
                    if(res.err_msg == "get_brand_wcpay_request:ok" ) {
                        layer.msg("支付成功", {shift: 6});
                        //var orderId=$("input[name='ordersPlateform.id']").val();
                        window.location.href="/b/order/list";
                    }else{
                        layer.msg("支付失败", {shift: 6});
                    }
                }
        );
    }

</script>
</html>